import Vue from "vue";
import App from "./App.vue";
import router from "./router";

// // 引入全局css样式控制文件
import "./assets/css/global.css";

import "./assets/fonts/iconfont.css";

// // 引入和注册element-ui组件库
import ElementUI from "element-ui";

// // 引入axios并配置
import axios from "axios";

// // 给axios配置请求拦截器

axios.interceptors.request.use(
  function(config) {
    var token = window.sessionStorage.getItem("token");
    if (token !== null) {
      config.headers.Authorization = token;
    }
    return config;
  },
  function(error) {
    return Promise.reject(error);
  }
);

axios.defaults.baseURL = "http://127.0.0.1:11333/api/private/v1/";

Vue.prototype.$http = axios;

Vue.use(ElementUI);

Vue.config.productionTip = false;

new Vue({
  router,
  render: h => h(App)
}).$mount("#app");
